

THIS CODE ALSO WORKS:


@echo off

set "str=000001.jpg 000001.pgm"
echo %str%
set inputfile=%str:~0,10%
set outputfile=%str:~11,10%
echo %inputfile% 
echo %outputfile%

djpeg -grayscale -outfile %outputfile% %inputfile%

)


REM THIS cODE BELOW ACTUALLY WORKS...

SET mycurrentrow=dtest.JPG doutnew.pgm
FOR /f "tokens=1* delims= " %%a IN ("%mycurrentrow%") DO (
  	SET inputfile=%%a
  	SET outputfile=%%b
) 

djpeg -grayscale -outfile %outputfile% %inputfile%
echo %inputfile%
echo %outputfile%
echo %mycurrentrow%



REM dir Test\*. /b /s /a-d >filenamelist.txt 

REM ## Above dumps the names of files in the directory c:\Daniel_Backup\Test\ and its subdirectories that don't have an ending to a text file. See  for more information on the handles here http://stackoverflow.com/questions/12847302/batch-file-to-list-all-files-in-a-dir-in-windows-7
REM ## Including subdirectories into the file list can be done fairly easily. See the same website http://stackoverflow.com/questions/12847302/batch-file-to-list-all-files-in-a-dir-in-windows-7 

REM FOR /F %%i IN (filenamelist.txt) DO C:\Daniel_Backup\Ocrad Stuff\djpeg.exe -grayscale -outfile myfile.pgm %%i

REM ## Above runs dicom2 with the handle -t0 (i.e. dump to text file) for every filename listed in the text file. 
REM ## Some information on for-loops in msdos can be found at http://ss64.com/nt/for_f.html
REM ## documentation for the dicom2.exe file can be found here: http://www.barre.nom.fr/medical/dicom2/usage-1.html#Conversion%20formats
REM ## dicom2.exe can be downloaded from the same website http://www.barre.nom.fr/medical/dicom2/download-install.html
